#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

struct Student {
    std::string name;
    std::string id;
    float grade;
};

int main() {
    int n;
    std::cout << "输入学生的数量: ";
    std::cin >> n;
    
    std::vector<Student> students(n);
    for (int i = 0; i < n; ++i) {
        std::cout << "输入学生" << (i + 1) << "的姓名、学号、成绩: ";
        std::cin >> students[i].name >> students[i].id >> students[i].grade;
    }
    
    std::sort(students.begin(), students.end(), [](const Student& a, const Student& b) {
        return a.grade > b.grade;
    });
    
    std::cout << "按成绩排序后的学生信息: \n";
    for (const Student& student : students) {
        std::cout << "姓名: " << student.name << ", 学号: " << student.id << ", 成绩: " << student.grade << std::endl;
    }
    
    return 0;
}